#pragma once

#include"HashTable.h"

namespace lwj
{
    // 2007
    template<class K, class Hash = HashFunc<K>>
    class unordered_set
    {
        struct SetKeyOfT
        {
            const K& operator()(const K& key)
            {
                return key;
            }
        };
    public:
        typedef typename HashTable<K, const K, SetKeyOfT, Hash>::iterator iterator;
        typedef typename HashTable<K, const K, SetKeyOfT, Hash>::const_iterator const_iterator;
        iterator begin()
        {
            return _ht.begin();
        }

        iterator end()
        {
            return _ht.end();
        }
        const_iterator begin()    const
        {
            return _ht.begin();
        }

        const_iterator end()      const
        {
            return _ht.end();
        }
        pair<iterator, bool> insert(const K& key)
        {
            return _ht.insert(key);
        }

        pair<iterator, bool> find(const K& key)
        {
            return _ht.find(key);
        }

        pair<iterator, bool> erase(const K& key)
        {
            return _ht.erase(key);
        }
    private:
        HashTable<K, const K, SetKeyOfT, Hash> _ht;
    };
}
